<?php
namespace app\index\controller;
use think\Controller;
use think\Exception;

class Pay extends Base
{
    public function index() {
        if(!$this->getLoginUser()){
            $this->error('请登录','user/login');
        }
        $orderId = input('get.id',0,'intval');
        if(empty($orderId)){
            $this->error('请求不合法');
        }
        $order = model('Order')->get($orderId);
        if(empty($order) || $order->status != 1 || $order->pay_status != 0 ){
            $this->error('无法操作');
        }
    if($order->username != $this->getLoginUser()->username){
        $this->error('不是同一个订单');
    }
    $deal = model('Deal')->get($order->deal_id);
   return $this->fetch('',[
       'deal' => $deal,
       'order' => $order,

   ]);
    }

}
